<?php

namespace App\AgentAdmin\Controllers;

use App\Admin\Repositories\AgentAccountDetail;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Alert;
use Dcat\Admin\Http\Controllers\AdminController;

class AgentAccountDetailController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new AgentAccountDetail(), function (Grid $grid) {
            $grid->model()->where('agent_id',(Admin::user()->id))->orderBy('created_at','desc');
            // $grid->column('id')->sortable();
            $grid->column('number');
            $grid->column('type')->using([1 => '收入', -1 => '提现'])->label([
                'default' => 'primary', // 设置默认颜色，不设置则默认为 default
                1 => 'success',
                -1 => 'danger',
            ]);
            $grid->column('video_id');
            $grid->column('created_at')->sortable()->filter();
        
            $grid->disableCreateButton();
            $grid->disableBatchActions();
            $grid->disableActions();
            $grid->disableFilterButton();

            //头部
            // $grid->header(function ($collection){
            //     $tips = Alert::make( '有任何疑问请联系客服','');
            //     return $tips->info();
            // });
        });
    }

}
